package com.zzu.base.common.pojo;

import com.zzu.base.common.enums.ResultStatusEnum;
import lombok.Data;


@Data
public class ResultResponse<T>  {
    private Integer code;
    private T data;
    private String msg;
    public static <T> ResultResponse<T> success(T data) {
        ResultResponse<T> response = new ResultResponse<>();
        response.setCode(200);
        response.setData(data);
        response.setMsg("success");
        return response;
    }
    public static <T> ResultResponse<T> error(T data, ResultStatusEnum resultStatusEnum) {
        ResultResponse<T> response=new ResultResponse<>();
        response.setCode(resultStatusEnum.getCode());
        response.setMsg(resultStatusEnum.getMessage());
        response.setData(data);
        return response;
    }
}
